﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chess
{
    public class Square
    {
        public enum Color {WHITE,BLACK}
        public Color color;
        public Piece piece;
        public int file,rank,ordinal;
        
        public Square(int intOrdinal)
        {
            ordinal = intOrdinal;
            file = intOrdinal % 16;
            rank = intOrdinal / 16;

            if(file==0 || file==2|| file==4 || file==6)
                if(rank==0 || rank==2 || rank==4 || rank==6)
                    color = Color.BLACK;
                else
                    color = Color.WHITE;
            else
                 if(rank==0 || rank==2 || rank==4 || rank==6)
                    color = Color.WHITE;
                 else              
                    color = Color.BLACK;    
        }
        
        public Color isColor
        {
            get {return color;}
        }
        public int File
        {
            get {return file;}
        }

        public int Rank
        {
            get {return rank;}
        }
        public int Ordinal
        {
            get {return ordinal;}
        }
        public Piece Piece
        {
            get {return piece;}
            set {piece = value;}
        }
    }
}
